<?php
import( 'de.ceus-media.framework.krypton.core.DefinitionAction' );
import( 'de.ceus-media.framework.krypton.exception.IO' );
import( 'classes.action.panel.EnvironmentSelector' );
import( 'classes.logic.Topic' );
import( 'classes.logic.Case' );
import( 'classes.logic.Result' );
/**
 *	Option Actions.
 *	@package		mv2.action.testing
 *	@extends		Framework_Krypton_Core_DefinitionAction
 *	@uses			Logic_Licencee
 *	@uses			Action_Panel_EnvironmentSelector
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			06.08.2007
 *	@version		0.1
 */
/**
 *	Option Actions.
 *	@package		mv2.action.testing
 *	@extends		Framework_Krypton_Core_DefinitionAction
 *	@uses			Logic_Licencee
 *	@uses			Action_Panel_EnvironmentSelector
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			06.08.2007
 *	@version		0.1
 */
class Action_Testing_Result extends Framework_Krypton_Core_DefinitionAction
{

/*
Uferstrasse 30
15754 Senzig

*/
	/**
	 *	Constructor.
	 *	@access		public
	 *	@return		void
	 */
	public function __construct()
	{
		parent::__construct();
		$this->loadLanguage( 'testing.result', 'result' );
		$this->loadLanguage( 'management.structure', 'structure' );
		$this->addAction( 'addRecord' );
		$action	= new Action_Panel_EnvironmentSelector();
	}

	protected function addRecord()
	{
		$request	= Framework_Krypton_Core_Registry::getStatic( "request" );
		$session	= Framework_Krypton_Core_Registry::getStatic( "session" );
		$words		= $this->words['result']['msg'];

		$runId		= $session->get( 'runId' );
		$caseId		= $request->get( 'caseId' );
		try
		{
			$logic	= new Logic_Result();
			$result	= $logic->addRecord( $caseId, $runId, $request->getAll(), "add_record_" );
			if( $result )
				$this->messenger->noteSuccess( $words['success_record_added'] );
			else
				$this->messenger->noteError( $words['error_record_not_added'] );
		}
		catch( Exception $e )
		{
			$this->handleException( $e, 'result', 'editCase' );
		}
	}
}
?>